package com.xhcl.system.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xhcl.common.core.domain.Stree;
import com.xhcl.common.core.text.Convert;
import com.xhcl.system.domain.TGgGkzfzh;
import com.xhcl.system.mapper.TGgGkzfzhMapper;
import com.xhcl.system.service.ITGgGkzfzhService;

/**
 * 国库支付局账号Service业务层处理
 * 
 * @author xhcl
 * @date 2020-08-24
 */
@Service
public class TGgGkzfzhServiceImpl implements ITGgGkzfzhService 
{
    @Autowired
    private TGgGkzfzhMapper tGgGkzfzhMapper;

    /**
     * 查询国库支付局账号
     * 
     * @param bm 国库支付局账号ID
     * @return 国库支付局账号
     */
    @Override
    public TGgGkzfzh selectTGgGkzfzhById(String bm)
    {
        return tGgGkzfzhMapper.selectTGgGkzfzhById(bm);
    }

    /**
     * 查询国库支付局账号列表
     * 
     * @param tGgGkzfzh 国库支付局账号
     * @return 国库支付局账号
     */
    @Override
    public List<TGgGkzfzh> selectTGgGkzfzhList(TGgGkzfzh tGgGkzfzh)
    {
        return tGgGkzfzhMapper.selectTGgGkzfzhList(tGgGkzfzh);
    }

    /**
     * 新增国库支付局账号
     * 
     * @param tGgGkzfzh 国库支付局账号
     * @return 结果
     */
    @Override
    public int insertTGgGkzfzh(TGgGkzfzh tGgGkzfzh)
    {
        return tGgGkzfzhMapper.insertTGgGkzfzh(tGgGkzfzh);
    }

    /**
     * 修改国库支付局账号
     * 
     * @param tGgGkzfzh 国库支付局账号
     * @return 结果
     */
    @Override
    public int updateTGgGkzfzh(TGgGkzfzh tGgGkzfzh)
    {
        return tGgGkzfzhMapper.updateTGgGkzfzh(tGgGkzfzh);
    }

    /**
     * 删除国库支付局账号对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTGgGkzfzhByIds(String ids)
    {
        return tGgGkzfzhMapper.deleteTGgGkzfzhByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除国库支付局账号信息
     * 
     * @param bm 国库支付局账号ID
     * @return 结果
     */
    @Override
    public int deleteTGgGkzfzhById(String bm)
    {
        return tGgGkzfzhMapper.deleteTGgGkzfzhById(bm);
    }
    
    /**
     * 查询国库支付局账号树列表
     * 
     * @return 所有国库支付局账号信息
     */
    @Override
    public List<Stree> selectTGgGkzfzhTree()
    {
        List<TGgGkzfzh> tGgGkzfzhList = tGgGkzfzhMapper.selectTGgGkzfzhList(new TGgGkzfzh());
        List<Stree> ztrees = new ArrayList<Stree>();
        Stree ztree = new Stree();
        ztree.setId("");
        ztree.setpId("");
        ztree.setName("全部");
        ztree.setTitle("全部");
        ztrees.add(ztree);
        for (TGgGkzfzh tGgGkzfzh : tGgGkzfzhList)
        {
            Stree ztree1 = new Stree();
            ztree1.setId(tGgGkzfzh.getBm());
            ztree1.setpId("");
            ztree1.setName(tGgGkzfzh.getYhmc());
            ztree1.setTitle(tGgGkzfzh.getYhmc()+"-"+tGgGkzfzh.getSkrzh()+"-"+tGgGkzfzh.getSkrmc());
            ztrees.add(ztree1);
        }
        return ztrees;
    }
}
